#include"processbar.h"
void process_v1()
{
    int num = 0;
    char buffer[101];
    char* p = "/-|\\";
    memset(buffer,0,sizeof(buffer));
    while(num<=100)
    {
        int n = num % strlen(p);
        memset(buffer,'#',num);
        printf("[%-100s][%d%%][%c] \r", buffer , num , p[n]);
        fflush(stdout);
        usleep(5000);
        num++;
    }
    printf("\n");
}



void process_v2(double total ,double current)
{
    if(total == 0.0f)
    {
        assert(" WRONG! total == 0!");
    }

    char buffer[101];
    memset( buffer, 0 , sizeof(buffer));
    char* p = "/-|\\";
    double rate = (current / total)*100;
    memset(buffer,'#',rate);
    printf("[%-100s][%.1lf%%][%c]\r ", buffer , rate , p[(int)rate % strlen(p)]);
    fflush(stdout);
    usleep(5000);
}
